package com.umeng.analytics.pro;

import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.Collections;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

public class bm implements cg, Serializable, Cloneable {
    static class a extends dp {
        private a() {

        }

        public void a(df arg8, bm arg9) throws cm {
            arg8.j();
            while (true) {
                da v0 = arg8.l();
                if (v0.b == 0) {
                    break;
                }

                switch (v0.c) {
                    case 1: {
                        if (v0.b == 13) {
                            dc v2_1 = arg8.n();
                            arg9.a = new HashMap(v2_1.c * 2);
                            for (int v0_1 = 0; v0_1 < v2_1.c; ++v0_1) {
                                String v3_1 = arg8.z();
                                bl v4 = new bl();
                                v4.a(arg8);
                                arg9.a.put(v3_1, v4);
                            }

                            arg8.o();
                            arg9.a(true);
                            break;
                        }

                        di.a(arg8, v0.b);
                        break;
                    }
                    case 2: {
                        if (v0.b == 15) {
                            db v2 = arg8.p();
                            arg9.b = new ArrayList(v2.b);
                            int v0_1;
                            for (v0_1 = 0; v0_1 < v2.b; ++v0_1) {
                                bk v3 = new bk();
                                v3.a(arg8);
                                arg9.b.add(v3);
                            }

                            arg8.q();
                            arg9.b(true);
                            break;
                        }

                        di.a(arg8, v0.b);
                        break;
                    }
                    case 3: {
                        if (v0.b == 11) {
                            arg9.c = arg8.z();
                            arg9.c(true);
                            break;
                        }

                        di.a(arg8, v0.b);
                        break;
                    }
                    default: {
                        di.a(arg8, v0.b);
                        break;
                    }
                }

                label_10:
                arg8.m();
            }

            arg8.k();
            arg9.o();
        }

        public void a(df arg1, cg arg2) throws cm {
            this.b(arg1, ((bm) arg2));
        }

        public void b(df arg5, bm arg6) throws cm {
            byte v3 = 12;
            arg6.o();
            arg5.a(bm.q());
            if (arg6.a != null) {
                arg5.a(bm.r());
                arg5.a(new dc((byte) 11, v3, arg6.a.size()));
                Iterator v2 = arg6.a.entrySet().iterator();
                while (v2.hasNext()) {
                    Object v0 = v2.next();
                    arg5.a((String) ((Entry) v0).getKey());
                    ((bl) ((Map.Entry) v0).getValue()).b(arg5);
                }

                arg5.e();
                arg5.c();
            }

            if (arg6.b != null && (arg6.k())) {
                arg5.a(bm.s());
                arg5.a(new db(v3, arg6.b.size()));
                Iterator v1 = arg6.b.iterator();
                while (v1.hasNext()) {
                    ((bl) v1.next()).b(arg5);
                }

                arg5.f();
                arg5.c();
            }

            if (arg6.c != null && (arg6.n())) {
                arg5.a(bm.t());
                arg5.a(arg6.c);
                arg5.c();
            }

            arg5.d();
            arg5.b();
        }

        public void b(df arg1, cg arg2) throws cm {
            this.a(arg1, ((bm) arg2));
        }
    }

    static class b implements do0 {

        private b() {

        }

        public a a() {
            return new a();
        }

        public dn b() {
            return this.a();
        }
    }

    static class c extends dq {
        private c() {

        }

        public void a(df arg4, bm arg5) throws cm {
            ((dl) arg4).a(arg5.a.size());
            Iterator v2 = arg5.a.entrySet().iterator();
            while (v2.hasNext()) {
                Object v0 = v2.next();
                ((dl) arg4).a((String) ((Entry) v0).getKey());
                ((bl) ((Map.Entry) v0).getValue()).b(arg4);
            }

            BitSet v0_1 = new BitSet();
            if (arg5.k()) {
                v0_1.set(0);
            }

            if (arg5.n()) {
                v0_1.set(1);
            }

            ((dl) arg4).a(v0_1, 2);
            if (arg5.k()) {
                ((dl) arg4).a(arg5.b.size());
                Iterator v1 = arg5.b.iterator();
                while (v1.hasNext()) {
                    ((bl) v1.next()).b(arg4);
                }
            }

            if (arg5.n()) {
                ((dl) arg4).a(arg5.c);
            }
        }

        public void a(df arg1, cg arg2) throws cm {
            this.a(arg1, ((bm) arg2));
        }

        public void b(df arg9, bm arg10) throws cm {
            byte v7 = 12;
            int v1 = 0;
            dc v2 = new dc((byte) 11, v7, ((dl) arg9).w());
            arg10.a = new HashMap(v2.c * 2);
            int v0;
            for (v0 = 0; v0 < v2.c; ++v0) {
                String v3 = ((dl) arg9).z();
                bl v4 = new bl();
                v4.a(arg9);
                arg10.a.put(v3, v4);
            }

            arg10.a(true);
            BitSet v0_1 = ((dl) arg9).b(2);
            if (v0_1.get(0)) {
                db v2_1 = new db(v7, ((dl) arg9).w());
                arg10.b = new ArrayList(v2_1.b);
                while (v1 < v2_1.b) {
                    bk v3_1 = new bk();
                    v3_1.a(arg9);
                    arg10.b.add(v3_1);
                    ++v1;
                }

                arg10.b(true);
            }

            if (v0_1.get(1)) {
                arg10.c = ((dl) arg9).z();
                arg10.c(true);
            }
        }

        public void b(df arg1, cg arg2) throws cm {
            this.b(arg1, ((bm) arg2));
        }
    }

    static class d implements do0 {

        private d() {

        }

        public c a() {
            return new c();
        }

        public dn b() {
            return this.a();
        }
    }

    public enum bm$e implements cn {
        SNAPSHOTS((short) 1, "snapshots"),
        JOURNALS((short) 2, "journals"),
        CHECKSUM((short) 3, "checksum");

        private static final Map<String, bm$e> d;
        private final short e;
        private final String f;

        static {
            d = new HashMap();
            Iterator it = EnumSet.allOf(bm$e.class).iterator();
            while (it.hasNext()) {
                bm$e eVar = (bm$e) it.next();
                d.put(eVar.b(), eVar);
            }
        }

        private bm$e(short s, String str) {
            this.e = s;
            this.f = str;
        }

        public static bm$e a(int i) {
            switch (i) {
                case 1:
                    return SNAPSHOTS;
                case 2:
                    return JOURNALS;
                case 3:
                    return CHECKSUM;
                default:
                    return null;
            }
        }

        public static bm$e a(String str) {
            return d.get(str);
        }

        public static bm$e b(int i) {
            bm$e a = a(i);
            if (a != null) {
                return a;
            }
            throw new IllegalArgumentException("Field " + i + " doesn't exist!");
        }

        public final short a() {
            return this.e;
        }

        public final String b() {
            return this.f;
        }
    }


    public Map<String, bl> a;
    public List<bk> b;
    public String c;
    public static final Map<e, cs> d;
    private static final long e = -5764118265293965743L;
    private static final dk f;
    private static final da g;
    private static final da h;
    private static final da i;
    private static final Map<Class<? extends dn>, do0> j;
    private bm$e[] k;

    static {
        f = new dk("IdTracking");
        g = new da("snapshots", (byte) 13, (short) 1);
        h = new da("journals", (byte) 15, (short) 2);
        i = new da("checksum", (byte) 11, (short) 3);
        HashMap v0 = new HashMap();
        j = ((Map) v0);
        ((Map) v0).put(dp.class, new b());
        j.put(dq.class, new d());
        EnumMap v0_1 = new EnumMap(e.class);
        ((Map) v0_1).put(bm$e.SNAPSHOTS, new cs("snapshots", (byte) 1, new cv((byte) 13, new ct((byte) 11), new cx((byte) 12, bl.class))));
        ((Map) v0_1).put(bm$e.JOURNALS, new cs("journals", (byte) 2, new cu((byte) 15, new cx((byte) 12, bk.class))));
        ((Map) v0_1).put(bm$e.CHECKSUM, new cs("checksum", (byte) 2, new ct((byte) 11)));
        d = Collections.unmodifiableMap(((Map) v0_1));
        cs.a(bm.class, bm.d);
    }

    public bm() {

        this.k = new bm$e[]{bm$e.JOURNALS, bm$e.CHECKSUM};
    }

    public bm(bm arg6) {
        this.k = new bm$e[]{bm$e.JOURNALS, bm$e.CHECKSUM};
        if (arg6.f()) {
            HashMap v2 = new HashMap();
            Iterator v3 = arg6.a.entrySet().iterator();
            while (v3.hasNext()) {
                Object v0 = v3.next();
                ((Map) v2).put(((Map.Entry) v0).getKey(), new bl((bl) ((Entry) v0).getValue()));
            }

            this.a = ((Map) v2);
        }

        if (arg6.k()) {
            ArrayList v1 = new ArrayList();
            Iterator<bk> v2_1 = arg6.b.iterator();
            while (v2_1.hasNext()) {
                ((List) v1).add(new bk(v2_1.next()));
            }
            this.b = ((List) v1);
        }

        if (arg6.n()) {
            this.c = arg6.c;
        }
    }

    public bm(Map arg1) {
        this();
        this.a = arg1;
    }

    public bm a(List arg1) {
        this.b = arg1;
        return this;
    }

    public bm a(Map arg1) {
        this.a = arg1;
        return this;
    }

    private void a(ObjectInputStream arg3) throws IOException, ClassNotFoundException {
        try {
            this.a(new cz(new dr(((InputStream) arg3))));
            return;
        } catch (cm v0) {
            throw new IOException(v0.getMessage());
        }
    }

    public void a(df arg3) throws cm {
        bm.j.get(arg3.D()).b().b(arg3, ((cg) this));
    }

    private void a(ObjectOutputStream arg3) throws IOException {
        try {
            this.b(new cz(new dr(((OutputStream) arg3))));
            return;
        } catch (cm v0) {
            throw new IOException(v0.getMessage());
        }
    }

    public bm$e a(int arg2) {
        return bm$e.a(arg2);
    }

    public bm a() {
        return new bm(this);
    }

    public bm a(String arg1) {
        this.c = arg1;
        return this;
    }

    public void a(bk arg2) {
        if (this.b == null) {
            this.b = new ArrayList();
        }

        this.b.add(arg2);
    }

    public void a(String arg2, bl arg3) {
        if (this.a == null) {
            this.a = new HashMap();
        }

        this.a.put(arg2, arg3);
    }

    public void a(boolean arg2) {
        if (!arg2) {
            this.a = null;
        }
    }

    public void b(boolean arg2) {
        if (!arg2) {
            this.b = null;
        }
    }

    public void b(df arg3) throws cm {
        bm.j.get(arg3.D()).b().a(arg3, ((cg) this));
    }

    public cn b(int arg2) {
        return this.a(arg2);
    }

    public void b() {
        this.a = null;
        this.b = null;
        this.c = null;
    }

    public int c() {
        int v0 = this.a == null ? 0 : this.a.size();
        return v0;
    }

    public void c(boolean arg2) {
        if (!arg2) {
            this.c = null;
        }
    }

    public Map d() {
        return this.a;
    }

    public void e() {
        this.a = null;
    }

    public boolean f() {
        boolean v0 = this.a != null ? true : false;
        return v0;
    }

    public int g() {
        int v0 = this.b == null ? 0 : this.b.size();
        return v0;
    }

    public Iterator h() {
        Iterator v0 = this.b == null ? null : this.b.iterator();
        return v0;
    }

    public List i() {
        return this.b;
    }

    public void j() {
        this.b = null;
    }

    public boolean k() {
        boolean v0 = this.b != null ? true : false;
        return v0;
    }

    public String l() {
        return this.c;
    }

    public void m() {
        this.c = null;
    }

    public boolean n() {
        boolean v0 = this.c != null ? true : false;
        return v0;
    }

    public void o() throws cm {
        if (this.a == null) {
            throw new dg("Required field \'snapshots\' was not present! Struct: " + this.toString());
        }
    }

    public cg p() {
        return this.a();
    }

    static dk q() {
        return bm.f;
    }

    static da r() {
        return bm.g;
    }

    static da s() {
        return bm.h;
    }

    static da t() {
        return bm.i;
    }

    public String toString() {
        StringBuilder v0 = new StringBuilder("IdTracking(");
        v0.append("snapshots:");
        if (this.a == null) {
            v0.append("null");
        } else {
            v0.append(this.a);
        }

        if (this.k()) {
            v0.append(", ");
            v0.append("journals:");
            if (this.b == null) {
                v0.append("null");
            } else {
                v0.append(this.b);
            }
        }

        if (this.n()) {
            v0.append(", ");
            v0.append("checksum:");
            if (this.c == null) {
                v0.append("null");
            } else {
                v0.append(this.c);
            }
        }

        v0.append(")");
        return v0.toString();
    }
}

